﻿<Core:DXWindow x:Class="ThanNhanTao.frmThongKeTongBNDungThuoc"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:Core="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:local="clr-namespace:ConvertCustom"
        xmlns:common="clr-namespace:ThanNhanTao.CommonControl"
        xmlns:my="clr-namespace:ThanNhanTao.CommonControl"
        Core:ThemeManager.ThemeName="Office2007Blue" Icon="/ThanNhanTao;component/Images/Icons/print-16x16.png"             
        Title="Thống kê bệnh nhân dùng thuốc" WindowState="Maximized">
    <Core:DXWindow.Resources>
        <Style TargetType="Label">
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        <Style TargetType="dxe:DateEdit">
            <Setter Property="Margin" Value="2,2" />
        </Style>
        <Style TargetType="dxe:ComboBoxEdit">
            <Setter Property="Margin" Value="1,1" />
        </Style>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="3,3" />
        </Style>
    </Core:DXWindow.Resources>
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="160"></RowDefinition>
                <RowDefinition Height="5"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <GroupBox Header="Thông tin thống kê">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"></RowDefinition>
                        <RowDefinition Height="28"></RowDefinition>
                        <RowDefinition Height="28"></RowDefinition>
                        <RowDefinition Height="10"></RowDefinition>
                        <RowDefinition Height="30"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="360"></ColumnDefinition>
                        <ColumnDefinition Width="10"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="140"></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <my:CalendarControl x:Name="calendar" Grid.RowSpan="4"></my:CalendarControl>
                    <!--<StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" Grid.Column="2">
                        <RadioButton Content="Tất cả" Grid.Row="1" HorizontalAlignment="Left" Name="rdoTatCa" VerticalAlignment="Center" GroupName="TrangThaiBenhNhan" />
                        <RadioButton Content="Đang diều trị" VerticalAlignment="Center" Margin="15,0,0,0" Name="rdoDangDieuTri" GroupName="TrangThaiBenhNhan" IsChecked="True"/>
                        <RadioButton Content="Đã ra viện" Margin="15,0,0,0" Name="rdoRaVien" VerticalAlignment="Center" GroupName="TrangThaiBenhNhan"/>
                    </StackPanel>-->
                    <Label Content="Khu vực:" Grid.Column="2" Grid.Row="1"/>
                    <dxe:ComboBoxEdit Grid.Column="3" Grid.Row="1" Name="cboKhuVuc">
                        <dxe:ComboBoxEditItem Content=" -- Tất cả --"></dxe:ComboBoxEditItem>
                        <dxe:ComboBoxEditItem Content="Khu A"></dxe:ComboBoxEditItem>
                        <dxe:ComboBoxEditItem Content="Khu B"></dxe:ComboBoxEditItem>
                        <dxe:ComboBoxEditItem Content="Khu C"></dxe:ComboBoxEditItem>
                        <dxe:ComboBoxEditItem Content="Khu D"></dxe:ComboBoxEditItem>
                    </dxe:ComboBoxEdit>
                    <Label Content="Tên thuốc:" Grid.Column="2" Grid.Row="2"/>
                    <dxe:ComboBoxEdit Grid.Column="3" Grid.Row="2" Name="cboTenThuoc">
                    </dxe:ComboBoxEdit>
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" Grid.Column="2" Grid.Row="4">
                        <Button Content="Thống kê" Name="btnThongKe" Width="80" Click="btnThongKe_Click" />
                        <Button Content="Đóng" Name="btnDong" Width="80" Click="btnDong_Click" />
                    </StackPanel>
                </Grid>
            </GroupBox>
            <dxg:GridControl Grid.Row="2" Name="GridDanhSachBenhNhan">
                <dxg:GridControl.Resources>
                    <ControlTemplate x:Key="editTemplate">
                        <StackPanel Orientation="Horizontal">
                            <!--<TextBlock x:Name="PART_Editor"/>-->
                            <CheckBox x:Name="PART_Editor"></CheckBox>
                        </StackPanel>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding Data.GioiTinh}" Value="True">
                                <Setter Property="Content" Value="Nam" TargetName="PART_Editor" />
                                <Setter Property="IsChecked" Value="True" TargetName="PART_Editor" />
                                <!--<Setter Property="IsEnabled" Value="False" TargetName="PART_Editor" />-->
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Data.GioiTinh}" Value="False">
                                <Setter Property="Content" Value="Nữ" TargetName="PART_Editor" />
                                <Setter Property="IsChecked" Value="False" TargetName="PART_Editor" />
                                <!--<Setter Property="IsEnabled" Value="False" TargetName="PART_Editor" />-->
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </dxg:GridControl.Resources>
                <dxg:GridControl.Columns>
                    <dxg:GridColumn Name="cluIdBenhNhan" Header="IdBenhNhan" FieldName="IdBenhNhan" Visible="False"/>
                    <dxg:GridColumn Name="cluSTT" Header="STT" Width="35" AllowEditing="False">
                        <dxg:GridColumn.DisplayTemplate>
                            <ControlTemplate>
                                <dxe:TextEdit Text="{Binding Path =Data.RowHandle.Value,Converter ={local:RowHandleToStringConverter},Mode =OneWay}" HorizontalAlignment="Center" EditMode="InplaceActive" />
                            </ControlTemplate>
                        </dxg:GridColumn.DisplayTemplate>
                    </dxg:GridColumn>
                    <dxg:GridColumn Header="Mã nhập viện" FieldName="SoNhapVien" AllowEditing="False" Width="60"/>
                    <dxg:GridColumn Header="Họ" FieldName="Ho" AllowEditing="False" Width="120"/>
                    <dxg:GridColumn Header="Tên" FieldName="Ten" AllowEditing="False" Width="70"/>
                    <dxg:GridColumn Header="SL thuốc" FieldName="SLThuocDung" AllowEditing="False" Width="70"/>
                    <dxg:GridColumn FieldName="GioiTinh" Header="Giới tính" ReadOnly="True" Width="70">
                        <dxg:GridColumn.CellTemplate>
                            <DataTemplate>
                                <dxe:TextEdit Text="{Binding Value, Converter={common:GioiTinhConverterToString}}" HorizontalAlignment="Left" EditMode="InplaceInactive" />
                            </DataTemplate>
                        </dxg:GridColumn.CellTemplate>
                    </dxg:GridColumn>
                    <dxg:GridColumn Header="Tuổi" FieldName="Tuoi" AllowEditing="False" Width="50"/>
                    <dxg:GridColumn Header="Khu" FieldName="Khu" AllowEditing="False" Width="50"/>
                </dxg:GridControl.Columns>
                <dxg:GridControl.TotalSummary>
                    <dxg:GridSummaryItem FieldName="SoNhapVien" SummaryType="Count" DisplayFormat=" {0:n0} bệnh nhân"/>
                    <dxg:GridSummaryItem FieldName="SLThuocDung" SummaryType="Sum" DisplayFormat=" Tổng SL: {0:n0} "/>
                </dxg:GridControl.TotalSummary>
                <dxg:GridControl.View>
                    <dxg:TableView ShowAutoFilterRow="True" AutoWidth="True"
                                           ShowTotalSummary="True"
                                           ShowGroupedColumns="False" ShowColumnHeaders="True"  MaxHeight="1800" Margin="2 2 2 2"
                                           ShowGroupPanel="False" AllowEditing="False" 
                                           AllowDrop="False" AllowGrouping="False" AllowMoveColumnToDropArea="False" 
                                           AllowMoving="False" IsColumnMenuEnabled="False" IsDeferredScrolling="False" 
                                           IsGroupPanelMenuEnabled="False" IsRowCellMenuEnabled="False"
                                           IsTotalSummaryMenuEnabled="False">
                    </dxg:TableView>
                </dxg:GridControl.View>
            </dxg:GridControl>
            
        </Grid>
    </Grid>
</Core:DXWindow>
